﻿<Window x:Class="WpfContentControl.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style  TargetType="ContentControl">
            <Setter Property="Foreground" Value="Red" />
            <Setter Property="Background" Value="Gray" />
            <Setter Property="FontSize" Value="18" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate  TargetType="{x:Type ContentControl}" >
                        <Grid>
                            <Ellipse StrokeThickness="10" Stroke="Yellow" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"  Fill="{TemplateBinding Background}"/>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate  x:Key="btnTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Ellipse x:Name="outerEllipse">
                    <Ellipse.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop  Offset="0" Color="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Background.Color}"/>
                                <GradientStop  Offset="1" Color="Red"/>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                <Ellipse  RenderTransformOrigin=".5,.5">
                    <Ellipse.RenderTransform>
                        <ScaleTransform ScaleX=".8" ScaleY=".8" />
                    </Ellipse.RenderTransform>
                    <Ellipse.Fill>
                        <LinearGradientBrush  StartPoint="0,0" EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Color="White" Offset="0"/>
                                <GradientStop Color="Transparent" Offset="1" />
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Ellipse.Fill>
                </Ellipse>
                <Viewbox>
                    <ContentPresenter   Margin="{TemplateBinding Padding}"/>
                </Viewbox>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="outerEllipse" Property="Fill"  Value="Orange" />
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                    <Setter  Property="RenderTransform">
                        <Setter.Value>
                            <ScaleTransform ScaleX=".9" ScaleY=".9" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <ContentControl Content="Hello"  Width="100" Height="100"/>
        <Button HorizontalAlignment="Left"  Height="100" Width="100" x:Name="btn" Content="OK" Padding="20"  Background="Gainsboro"
                TextElement.FontSize="12" Template="{StaticResource btnTemplate}">    
        </Button>
        
         
        <ProgressBar Height="17" IsIndeterminate="True" HorizontalAlignment="Left" Margin="38,249,0,0" Name="progressBar1" VerticalAlignment="Top" Width="361" />
        <StackPanel Height="79" HorizontalAlignment="Left" Margin="37,11,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="200">
            <CheckBox Content="CheckBox" Height="16" Name="checkBox1" />
            <CheckBox   Height="37" Margin="0,10,0,0" Name="checkBox2" >
                <Image   Source="r.png" />
            </CheckBox>
        </StackPanel>
    </Grid>
</Window>
